home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / hsrc_117.zip / CARBOMB.C < prev    next >
C/C++ Source or Header  |  1990-08-21  |  4KB  |  146 lines

  1. #include "msgg.h"
  2. #include "twindow.h"
  3. #include "keys.h"
  4. #include "headedit.h"
  5.  
  6.  
  7. int pascal bomb_who (struct _bomb_addr *bomb_addr) {
  8.  
  9.     long x;
  10.     static char zone[6]="";
  11.     static char net[6]="";
  12.     WINDOW *wndd;
  13.     FIELD *fldd;
  14.     int returncode;
  15.  
  16.     clear_message();
  17.     wndd=establish_window(4,maxy-7,8,40);
  18.     set_border(wndd,3);
  19.     set_title(wndd," Bomb Run ");
  20.     set_colors(wndd,BORDER,7,0,0);
  21.     display_window(wndd);
  22.     wcursor(wndd,0,0);
  23.     wprintf(wndd," F10 to bomb net shown or ESC to abort");
  24.     if (!*zone || !(word)atol(zone)) {
  25.         sprintf(zone,"%u",curaddress.zone);
  26.     }
  27.     if (!*net || !(word)atol(net)) {
  28.         sprintf(net,"%u",curaddress.net);
  29.     }
  30.     init_template(wndd);
  31.     wprompt(wndd,1,3,"Zone:");
  32.     wprompt(wndd,1,4,"Net:");
  33.     fldd=establish_field(wndd,9,3,msk5,zone,'N');
  34.     field_window(fldd,"bombzone  ",40,5);
  35.     fldd=establish_field(wndd,9,4,msk5,net,'N');
  36.     field_window(fldd,"bombnet   ",40,6);
  37. BombOver:
  38.     returncode=data_entry(wndd);
  39.     if (returncode==ESC){
  40.          delete_window(wndd);
  41.          return 0;
  42.     }
  43.     if (returncode!=F10) goto BombOver;
  44.     if(!*zone || !*net || !(word)atol(zone) || !(word)atol(net)) {
  45.         error_message(" You must fill in all fields! ");
  46.         pause();
  47.         goto BombOver;
  48.     }
  49.     bomb_addr->zone=(word)atol(zone);
  50.     bomb_addr->net=(word)atol(net);
  51.     for (x=0;x<(nidxsize+1);x++) {
  52.         if (nidx[x].zone==bomb_addr->zone && nidx[x].net==bomb_addr->net) break;
  53.     }
  54.     if(x>nidxsize) {
  55.         error_message(" Unknown net--can't bomb ");
  56.         pause();
  57.         goto BombOver;
  58.     }
  59.     any_message(" I sure hope you know what you're doing... ");
  60.     sleep(1);
  61.     delete_window(wndd);
  62.     return 1;
  63. }
  64.  
  65.  
  66.  
  67. int pascal fill_in_carbon (struct _carbon *carbon) {
  68.  
  69.     char name[36]="";
  70.     WINDOW *wndd;
  71.     FIELD *fldd;
  72.     int returncode;
  73.  
  74.     clear_message();
  75.     if((currarea->attr & NET) || (currarea->attr & ALTERNATE)) {
  76.         wndd=establish_window(4,maxy-7,12,55);
  77.     }
  78.     else wndd=establish_window(4,maxy-7,6,55);
  79.     set_border(wndd,3);
  80.     set_title(wndd," Who gets this carbon? ");
  81.     set_colors(wndd,BORDER,7,0,0);
  82.     display_window(wndd);
  83.     wcursor(wndd,0,0);
  84.     wprintf(wndd," F10 to accept or ESC to abort");
  85.     *dest=0;
  86.     *dest_net=0;
  87.     *d_zone=0;
  88.     strcpy(d_point,"0");
  89.     strcpy(cost,"0");
  90.     init_template(wndd);
  91.     wprompt(wndd,1,2,"Name:");
  92.     if((currarea->attr & NET) || (currarea->attr & ALTERNATE)) {
  93.         wprompt(wndd,1,3,"Zone:");
  94.         wprompt(wndd,1,4,"Net:");
  95.         wprompt(wndd,1,5,"Node:");
  96.         wprompt(wndd,1,6,"Point:");
  97.         wprompt(wndd,1,7,"Cost:");
  98.     }
  99.     fldd=establish_field(wndd,8,2,msk35,name,'a');
  100.     field_help(fldd,find_sysop);
  101.     if((currarea->attr & NET) || (currarea->attr & ALTERNATE)) {
  102.         fldd=establish_field(wndd,8,3,msk5,d_zone,'N');
  103.         field_window(fldd,"carbzone  ",40,5);
  104.         fldd=establish_field(wndd,8,4,msk5,dest_net,'N');
  105.         field_window(fldd,"carbnet   ",40,5);
  106.         fldd=establish_field(wndd,8,5,msk5,dest,'N');
  107.         field_window(fldd,"carbnode  ",40,6);
  108.         fldd=establish_field(wndd,8,6,msk5,d_point,'N');
  109.         field_validate(fldd,dest_check);
  110.         field_window(fldd,"carbpoint ",40,6);
  111.         fldd=establish_field(wndd,8,7,msk5,cost,'N');
  112.         field_window(fldd,"carbcost  ",40,7);
  113.     }
  114.     prep_template(wndd);
  115. CarbOver:
  116.     returncode=data_entry(wndd);
  117.     if (returncode==ESC){
  118.          delete_window(wndd);
  119.          return 0;
  120.     }
  121.     if (returncode!=F10) goto CarbOver;
  122.     rstrip(name);
  123.     if((currarea->attr & NET) || (currarea->attr & ALTERNATE)) {
  124.         if(!*d_zone || !*dest_net || !*dest || !*d_point || !(word)atol(d_zone) || !(word)atol(dest_net)) {
  125.             error_message(" You must fill in all fields! ");
  126.             pause();
  127.             goto CarbOver;
  128.         }
  129.     }
  130.     else if(!*name) {
  131.         delete_window(wndd);
  132.         return 0;
  133.     }
  134.     strcpy(carbon->name,name);
  135.     if((currarea->attr & NET) || (currarea->attr & ALTERNATE)) {
  136.         carbon->zone=(word)atol(d_zone);
  137.         carbon->net=(word)atol(dest_net);
  138.         carbon->node=(word)atol(dest);
  139.         carbon->point=(word)atol(d_point);
  140.         carbon->cost=atoi(cost);
  141.     }
  142.     delete_window(wndd);
  143.     return 1;
  144. }
  145.  
  146.